package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.OrgDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.org.vo.*;

/**
 * 组织机构 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrgMapper extends BaseMapperX<OrgDO> {

    default PageResult<OrgDO> selectPage(OrgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrgDO>()
                .likeIfPresent(OrgDO::getOrgName, reqVO.getOrgName())
                .eqIfPresent(OrgDO::getOrgCode, reqVO.getOrgCode())
                .eqIfPresent(OrgDO::getOrgType, reqVO.getOrgType())
                .eqIfPresent(OrgDO::getParentId, reqVO.getParentId())
                .eqIfPresent(OrgDO::getDisabled, reqVO.getDisabled())
                .betweenIfPresent(OrgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrgDO::getId));
    }

}